package com.example.mall_system.controller;

import com.example.mall_system.common.Result;
import com.example.mall_system.entity.Category;
import com.example.mall_system.mapper.CategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/category")
public class CategoryController {
    @Autowired
    private CategoryMapper categoryMapper;

    @GetMapping
    public Result getAllCategories() {
        List<Category> list = categoryMapper.getAllCategories();
        return Result.success(list);
    }
} 